package cn.edu.neusoft.demo.hospital2.Service.impl;

import cn.edu.neusoft.demo.hospital2.Dao.ProblemFeedbackDao;
import cn.edu.neusoft.demo.hospital2.pojo.ProblemFeedback;
import cn.edu.neusoft.demo.hospital2.Service.ProblemFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProblemFeedbackServiceImpl implements ProblemFeedbackService {

    @Autowired
    private ProblemFeedbackDao problemFeedbackDao;

    @Override
    public boolean submitFeedback(ProblemFeedback problemFeedback) {
        return problemFeedbackDao.addProblemFeedback(problemFeedback) > 0;
    }

    @Override
    public List<ProblemFeedback> getAllFeedbacks() {
        return problemFeedbackDao.getAllFeedbacks();
    }

    @Override
    public List<ProblemFeedback> getFeedbacksByUserId(Integer userId) {
        return problemFeedbackDao.getFeedbackByUserId(userId);
    }

    @Override
    public ProblemFeedback getFeedbackById(Integer feedbackId) {
        return problemFeedbackDao.getFeedbackById(feedbackId);
    }

    @Override
    public boolean processFeedback(ProblemFeedback problemFeedback) {
        return problemFeedbackDao.processFeedback(problemFeedback) > 0;
    }

    @Override
    public boolean updateFeedback(ProblemFeedback problemFeedback) {
        return problemFeedbackDao.updateById(problemFeedback) > 0;
    }

    @Override
    public boolean deleteFeedback(Integer feedbackId) {
        return problemFeedbackDao.deleteById(feedbackId) > 0;
    }
}